Repository navigation
fix: send one cancel request for concurrent cancel() calls - #604
Closed
vuanhphung wants to merge 1 commit into
Closed
vuanhphung wants to merge 1 commit into
vuanhphung wants to merge 1 commit into
Conversation
DBSQLOperation.cancel() set its cancelled flag only after the backend cancel resolved, so concurrent calls on one operation each sent their own request: three cancel() calls produced three Thrift CancelOperation RPCs. Concurrent calls now share the in-flight request. It is cleared when it settles, so a failed cancel can still be retried. The kernel backend already sent a single CancelStatement. Found by databricks-driver-test STATEMENT-022 (Simultaneous Statement Cancellation). Signed-off-by: Vu Anh Phung <vu.phung@databricks.com> Co-authored-by: Isaac <no-reply@databricks.com>
vuanhphung
temporarily deployed
to
azure-prod
November 13, 2026 08:12 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 13, 2026 08:12 — with
GitHub Actions
Inactive
vuanhphung
temporarily deployed
to
azure-prod
November 13, 2026 08:12 — with
GitHub Actions
Inactive
Collaborator
Author
|
Closing. STATEMENT-022 now accepts one cancel RPC per concurrent cancel() call and only requires that the calls are safe: none throws or hangs, and the statement ends canceled. main already meets that on Thrift and SEA (3 live passthrough runs per backend plus unit probes), so this change would only reduce the Thrift CancelOperation count. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DBSQLOperation.cancel()setcancelledonly after the backend cancel resolved (lib/DBSQLOperation.ts:206-213), so concurrentcancel()calls on one operation each sent their own request. On a live warehouse, three concurrentcancel()calls on a running Thrift statement sent threeCancelOperationRPCs. databricks-driver-test STATEMENT-022 (Simultaneous Statement Cancellation) requires exactly one on Thrift. The kernel backend already sends a singleCancelStatement, becausekernelCancelsets its flag before the RPC.Concurrent calls now share the in-flight cancel request. It is cleared when it settles, so a failed cancel rejects every waiting caller, leaves the operation un-cancelled (as before), and can be retried.
Verification:
tests/unit/DBSQLOperation.test.ts: one RPC for three concurrent calls, and a shared failure followed by a successful retry. Both fail without the fix (3 and 2 RPCs).npm test: 1753 passing.npm run lintand prettier are clean.CancelOperation(it sent three onmain), and STATEMENT-015 (single cancel) plus SEA STATEMENT-015/022 still pass.This pull request and its description were written by Isaac.